package priv.pront.code.mati.national.practice;

import java.util.Scanner;

/**
 * @Author: Pronting
 * @Description:
 * @DateTime: 2023/12/2 14:27
 **/
public class P1638_逛画展 {

    static int N, M, L, R, i = 0, num, ansL, ansR;
    static int[] n = new int[1000000];
    static int[] m = new int[2001];

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        N = scanner.nextInt(); // 博览馆内的图画总数
        M = scanner.nextInt(); // 这些图画是由多少位名师的画所绘画的
        for (int i = 0; i < N; i++) {
            n[i] = scanner.nextInt();
        }
        i = 0;
        while (num != M) {
            if (m[n[i]] == 0) num++;
            m[n[i]]++;
            R++;
            i++;
        }
        while (m[n[L]] > 1)
            m[n[L++]]--;
        ansL = L;
        ansR = R;
        while (i < N) {
            m[n[i]]++;
            R++;
            i++;
            while (m[n[L]] > 1)
                m[n[L++]]--;
            if (ansR - ansL > R - L) {
                ansR = R;
                ansL = L;
            }
        }
        System.out.println(ansL + 1 + " " + ansR);
    }
}
